class Tile {
    id = 0;
    picture = new Image();
    pictureurl = "";
    walkable: boolean;
    constructor(config: any) {
        this.id = config.id;

        this.pictureurl = config.picture;


        // const avatarTexture = new Image();
        // avatarTexture.src = picUrl;
        this.walkable = config.canWalk;


    }

}
class TileManager {
    tiles: Tile[] = [];

    parseFromConfig(obj: any) {
        for (let item of obj.tile) {
            const tile = new Tile(item)
            this.tiles.push(tile)
        }
    }
    getTileById(id: number) {
        for (let item of this.tiles) {
            if (item.id == id) {
                return item;
            }
        }
        throw `missing tileid : ${id}`;
    }

}
const tileManager = new TileManager();